company = {"BOSS":"唐僧","CTO":"悟空","CFO":"猪八戒","搬砖":"沙僧","苦力":"白龙马"}
#字典的输出
print(company["CTO"])
print(company["BOSS"])

#方法一
for i in company:
    print(f"{i}是{company[i]}")
#方法二
for i,j in company.items():
    print(f"{i}是{j}")

#判断对象是否在字典里（优化用in 与 not in）
while True:

    character = input("请输入你要查询的对象（ \033[31m悟空\033[0m 或者 \033[31m白骨精\033[0m ）：")

    if character == "悟空":
        print("悟空存在")
    elif character == "白骨精":
        print("白骨精不存在")
    elif character.upper() == "Q":
        print("查询已结束！")
        break
    else:
        print("\033[31m您的输入不在查询范围之内！\033[0m")
